package com.sk.bilibili.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sk.bilibili.bean.CoinRecord;
import com.sk.bilibili.other.R;
import com.sk.bilibili.service.CoinRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
* @author 邵康
* @date 2021/12/04 18:54
*/
@Api(tags = "投币记录")
@CrossOrigin
@RestController
@RequestMapping("/coinRecord")
public class CoinRecordController {

    @Autowired
    private CoinRecordService coinRecordService;

    @ApiOperation("add")
    @PostMapping("/add")
    public R<Void> add(@RequestBody CoinRecord coinRecord){
        return coinRecordService.add(coinRecord);
    }

    @ApiOperation("delete")
    @GetMapping("/delete")
    public R<Void> delete(Integer id){
        return coinRecordService.delete(id);
    }

    @ApiOperation("update")
    @PostMapping("/update")
    public R<Void> update(@RequestBody CoinRecord coinRecord){
        return coinRecordService.update(coinRecord);
    }

    @ApiOperation("获取当前用户的所有硬币记录")
    @GetMapping("/getAll")
    public R<List<CoinRecord>> getAll(){
        return coinRecordService.getAll();
    }

}
